Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build support gcc8 for other arch #567

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

shuai132
Copy link
Contributor

See: #502

Tested on toolchain-riscv32-esp @ 8.4.0+2021r2-patch3

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@earlephilhower
Copy link
Owner

@shuai132 the ESP32 build is still busted with a GCC bug:

In file included from /home/runner/work/ESP8266Audio/ESP8266Audio/libraries/ESP8266Audio/src/AudioGeneratorMIDI.cpp:69:
/home/runner/work/ESP8266Audio/ESP8266Audio/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h: In function 'void tsf_channel_midi_control(tsf*, int, int, int)':
/home/runner/work/ESP8266Audio/ESP8266Audio/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h:2101:1: error: insn does not satisfy its constraints:
 }
 ^
(insn 858 342 343 51 (set (reg:SF 19 f0 [407])
        (mem/u/c:SF (symbol_ref/u:SI ("*.LC248") [flags 0x2]) [0  S4 A32])) "/home/runner/work/ESP8266Audio/ESP8266Audio/libraries/ESP8266Audio/src/libtinysoundfont/tsf.h":2054 47 {movsf_internal}
     (nil))
during RTL pass: postreload

Can you add a check for XTENSA to the condition, instead of looking the the patch level? Like:

#if (__GNUC__ == 8) && defined(__XTENSA__)

@shuai132 shuai132 changed the title Fix build support for newer gcc8 Fix build support gcc8 for other arch Aug 31, 2022
@shuai132
Copy link
Contributor Author

@earlephilhower Good idea,
I just tested on ESP32C3 toolchain before, which is 10.x.

And my esp32 toolchain(maybe latest) seems still 8.x:

echo | ./xtensa-esp32-elf-gcc -dM -E - | grep GNU
#define __GNUC_PATCHLEVEL__ 0
#define __GNUC__ 8
#define __GNUC_STDC_INLINE__ 1
#define __GNUC_MINOR__ 4

@earlephilhower earlephilhower merged commit 93c4e3a into earlephilhower:master Aug 31, 2022
@shuai132
Copy link
Contributor Author

Thanks, risc-v gcc 8.4 works now!

➜  ./riscv32-esp-elf-gcc --version
riscv32-esp-elf-gcc (crosstool-NG esp-2021r2-patch3) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@shuai132
Copy link
Contributor Author

shuai132 commented Sep 1, 2022

I'm using platformio,
I tested my ESP32, there is no build issues(I'm sure libtinysoundfont/tsf.h has be compiled):

Maybe only arduino has the compile error.
@earlephilhower

PLATFORM: Espressif 32 (5.1.1+sha.4901957) > M5Stack Core2
HARDWARE: ESP32 240MHz, 4.31MB RAM, 16MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.20004.220818 (2.0.4) 
 - tool-esptoolpy @ 1.30300.0 (3.3.0) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch3

gcc in pio:

➜  .espressif tools/xtensa-esp32-elf/esp-2021r2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG esp-2021r2) 8.4.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcc in Arduino:

➜  packages /Users/shuai/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/xtensa-esp32-elf-gcc --version
xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I download latest version Arduino and libs, I got a lot other error, I don't know a lot about Arduino IDE. And I guss there are some incompatible issues.
Finally, I just test it for fun :) , I don't use Arduino IDE. If there is a bug, hope helpful.

/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputI2S.cpp: In member function 'bool AudioOutputI2S::SetPinout()':
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputI2S.cpp:95:41: error: 'i2s_pin_config_t' has no non-static data member named 'mck_io_num'
         .data_in_num = I2S_PIN_NO_CHANGE};
                                         ^
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputI2S.cpp: In member function 'bool AudioOutputI2S::begin(bool)':
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputI2S.cpp:232:28: error: 'I2S_MCLK_MULTIPLE_DEFAULT' was not declared in this scope
           .mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT, // Unused
                            ^
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputI2S.cpp:233:28: error: 'I2S_BITS_PER_CHAN_DEFAULT' was not declared in this scope
           .bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample
                            ^
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputI2S.cpp:234:7: error: 'i2s_config_t' has no non-static data member named 'mclk_multiple'
       };
       ^
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp: In constructor 'AudioOutputSPDIF::AudioOutputSPDIF(int, int, int)':
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp:108:22: error: 'I2S_MCLK_MULTIPLE_DEFAULT' was not declared in this scope
     .mclk_multiple = I2S_MCLK_MULTIPLE_DEFAULT, // Unused
                      ^
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp:109:22: error: 'I2S_BITS_PER_CHAN_DEFAULT' was not declared in this scope
     .bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT // Use bits per sample
                      ^
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp:110:3: error: 'i2s_config_t' has no non-static data member named 'mclk_multiple'
   };
   ^
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp: In member function 'bool AudioOutputSPDIF::SetPinout(int, int, int)':
/Users/shuai/Documents/Arduino/libraries/ESP8266Audio/src/AudioOutputSPDIF.cpp:159:3: error: 'i2s_pin_config_t' has no non-static data member named 'mck_io_num'
   };
   ^
Multiple libraries were found for "SD.h"
 Used: /Users/shuai/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/SD
 Not used: /Applications/Arduino.app/Contents/Java/libraries/SD
Multiple libraries were found for "WiFiClient.h"
 Used: /Users/shuai/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi
 Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
Error compiling for board ESP32 Dev Module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants